﻿namespace Cos.Core.NHibernate
{
    public class CustomUserFieldUserValuePK
    {
        public virtual string ApplicationName { get; set; }

        public virtual string CustomUserFieldName { get; set; }

        public virtual string Username { get; set; }

        #region Object Overrides

        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return false;
            }

            var model = obj as CustomUserFieldUserValuePK;

            return model != null && this.Username == model.Username && this.ApplicationName == model.ApplicationName &&
                   this.CustomUserFieldName == model.CustomUserFieldName;
        }

        public override int GetHashCode()
        {
            return this.Username.GetHashCode()
                ^ this.ApplicationName.GetHashCode()
                ^ this.CustomUserFieldName.GetHashCode();
        }

        #endregion
    }
}
